<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:pe="http://primefaces.org/ui/extensions">


    <ui:define name="content">
        <h:outputStylesheet library="css" name="printing.css"></h:outputStylesheet>
        <h:form>

            <p:panel >
                <f:facet name="header"  >
                    <p:outputLabel value="Collecting Centre Collection Detail Report" styleClass="noPrintButton"/>
                </f:facet>
                <h:panelGrid columns="2" styleClass="noPrintButton">
                    <h:outputLabel value="From"/>
                    <p:calendar id="frmDate" value="#{commonReport.fromDate}" styleClass="dateTimePicker" navigator="true"  pattern="dd MMMM yyyy hh:mm:ss a" >
                    </p:calendar>

                    <h:outputLabel value="To"/>
                    <p:calendar id="toDate" value="#{commonReport.toDate}" styleClass="dateTimePicker" navigator="true" pattern="dd MMMM yyyy hh:mm:ss a" >
                    </p:calendar>

                </h:panelGrid> 
                <h:panelGrid columns="4" styleClass="noPrintButton">
                    <p:spacer width="40"/>
                    <p:commandButton value="Process" ajax="false"  styleClass="noPrintButton " style="float: right;" action="#{commonReport.createCollectingCenterSummeryTable}" />

                    <p:commandButton ajax="false" value="Print"  styleClass="noPrintButton" style="float: right;" >
                        <p:printer target="panelPrint" />
                    </p:commandButton>
                    <p:commandButton ajax="false" value="Excel" action="#" actionListener="#{commonReport.createCollectingCenterSummeryTable}" >
                        <pe:exporter type="xlsx" target="tbl" fileName="Collecting_Centre_Collection_Detail_Report"   />
                    </p:commandButton> 
                </h:panelGrid>

            </p:panel>
            <p:panel id="panelPrint" styleClass="noBorder summeryBorder">
                <p:dataTable id="tbl" value="#{commonReport.collectingCenteRows}" var="r" rowIndexVar="i">
                    <f:facet name="header">
                        <h:outputLabel value="Collecting Centre Collection Summery Report"/> 
                        <br></br>
                        <h:outputLabel value="From  "/>                     
                        <h:outputLabel value="#{commonReport.fromDate}" >
                            <f:convertDateTime pattern="yyyy MMMM dd hh:mm:ss a" />
                        </h:outputLabel>
                        <h:outputLabel value="- To "/>                       
                        <h:outputLabel value="#{commonReport.toDate}" >
                            <f:convertDateTime pattern="yyyy MMMM dd hh:mm:ss a" />
                        </h:outputLabel>

                    </f:facet>
                    <p:column headerText="No">
                        <f:facet name="header">
                            <h:outputLabel value="No"/>                        
                        </f:facet>
                        <h:outputLabel value="#{i+1}"/>
                    </p:column>
                    <p:column headerText="Col. Center Name" >
                        <f:facet name="header">
                            <h:outputLabel value="Col. Center Name"/>                        
                        </f:facet>
                        <h:outputLabel value="#{r.i.name}"/>
                    </p:column>
                    <p:column headerText="CC Total" styleClass="averageNumericColumn">
                        <f:facet name="header">
                            <h:outputLabel value="CC Total"/>                        
                        </f:facet>
                        <h:outputLabel value="#{r.totalCC}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </p:column>

                    <p:column headerText="Hos Total" styleClass="averageNumericColumn">
                        <f:facet name="header">
                            <h:outputLabel value="Hos Total"/>                        
                        </f:facet>
                        <h:outputLabel value="#{r.totalHos}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </p:column>
                    <p:column headerText="Vat Total" styleClass="averageNumericColumn">
                        <f:facet name="header">
                            <h:outputLabel value="Vat Total"/>                        
                        </f:facet>
                        <h:outputLabel value="#{r.totalVat}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </p:column>

                    <p:column headerText="Total" styleClass="averageNumericColumn">
                        <f:facet name="header">
                            <h:outputLabel value="Net Total"/>                        
                        </f:facet>
                        <h:outputLabel value="#{r.total}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </p:column>
                    <p:column headerText="Vat Plus Total" styleClass="averageNumericColumn">
                        <f:facet name="header">
                            <h:outputLabel value="Net Total"/>                        
                        </f:facet>
                        <h:outputLabel value="#{r.total+r.totalVat}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </p:column>

                    <p:columnGroup type="footer">  
                        <p:row>                              
                            <p:column footerText="Total" colspan="2" />
                            <p:column footerText="#{commonReport.totalCC}" style=" text-align: right;">
                                <f:facet name="footer">
                                    <h:outputLabel value="#{commonReport.totalCC}" style=" text-align: right;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </f:facet>
                            </p:column> 
                            <p:column footerText="#{commonReport.totalHos}" style=" text-align: right;">
                                <f:facet name="footer">
                                    <h:outputLabel value="#{commonReport.totalHos}" style=" text-align: right;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </f:facet>
                            </p:column>
                            <p:column footerText="#{commonReport.totalVat}" style=" text-align: right;">
                                <f:facet name="footer">
                                    <h:outputLabel value="#{commonReport.totalVat}" style=" text-align: right;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </f:facet>
                            </p:column>
                            <p:column footerText="#{commonReport.total}" style=" text-align: right;">
                                <f:facet name="footer">
                                    <h:outputLabel value="#{commonReport.total}" style=" text-align: right;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </f:facet>
                            </p:column>
                            <p:column footerText="#{commonReport.total+commonReport.totalVat}" style=" text-align: right;">
                                <f:facet name="footer">
                                    <h:outputLabel value="#{commonReport.total+commonReport.totalVat}" style=" text-align: right;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </f:facet>
                            </p:column>
                        </p:row>  
                    </p:columnGroup>  
                </p:dataTable>

            </p:panel>   

        </h:form>

    </ui:define>

</ui:composition>
